<div ng-include src="'tpl/public/header.html'"></div> 
<div class="contents">
  <ol class="breadcrumb">
    <li><a href="#/index/panel">首页</a></li>
    <li class="active"><span ng-if="t=='02'">信托</span><span ng-if="t=='03'">资管</span><span ng-if="t=='07'">债权基金</span>列表</li>
  </ol>
  <form class="form-inline search-box" role="form" ng-submit="search()" novalidate>
    <div class="form-group" style="display:table">
      <label style="float:left;width:50px;">
        <input type="checkbox" name="ptype" value="02" ng-click="changeProductType();">信托
      </label>
      <label style="float:left;width:50px;">
        <input type="checkbox" name="ptype" value="03" ng-click="changeProductType();">资管
      </label>
     <label style="float:left;width:120px;">
        <input type="checkbox" name="ptype" value="07" ng-click="changeProductType();">债权基金
      </label>
    </div>
    <div class="form-group">
      <label class="sr-only" >产品名称</label>
      <input type="text" class="form-control" placeholder="产品名称" ng-model="searchMap.pName">
      <input type="hidden" ng-model="searchMap.pType" value="{{t}}" />
    </div>
    <div class="form-group">
      <label class="sr-only" >产品负责人</label>
      <input type="text" class="form-control" placeholder="产品负责人" ng-model="searchMap.userName">
    </div>
    <!--<div class="form-group">
      <label class="sr-only" >产品类型</label>
      <select class="form-control" ng-model="searchMap.pType" ng-options="m.value as m.text for m in productTypeModel" placeholder="产品类型"><option value="">--选择产品类型--</option></select>
    </div>-->
        <div class="form-group">
      <label class="sr-only" >审核状态</label>
      <select class="form-control" ng-model="searchMap.status" ng-options="m.value as m.text for m in dictMap['productStatusMergeModel']" placeholder="审核状态"><option value="">--选择审核状态--</option></select>
    </div> 
    <div class="form-group">
      <label class="sr-only" >发布状态</label>
      <select class="form-control" ng-model="searchMap.pPublicStatus" ng-options="m.value as m.text for m in productPublicStatusModel" placeholder="发布状态"><option value="">--选择发布状态--</option></select>
    </div> 

    <div class="form-group">
      <label class="sr-only" >销售状态</label>
      <select class="form-control" ng-model="searchMap.pSaleStatus" ng-options="m.value as m.text for m in dictMap['productSaleStatusModel']" placeholder="销售状态"><option value="">--选择销售状态--</option></select>
    </div>
    <div class="form-group">
      <label class="sr-only" >产品对接人</label>
      <input type="text" class="form-control" placeholder="产品对接人" ng-model="searchMap.pAccessName">
    </div>
    <div class="form-group">
      <label class="sr-only" >对接人手机号</label>
      <input type="text" class="form-control" placeholder="对接人手机号" ng-model="searchMap.pAccessMobile">
    </div>
    <div class="form-group">
       <label class="sr-only" >是否包销</label>
      <select class="form-control" ng-model="searchMap.flagBaoxiao" placeholder="是否包销"><option value="">--选择是否包销--</option><option value="true">是</option><option value="false">否</option></select>
    </div>
    <div class="form-group" ng-if="false">
      <label class="sr-only" >大小配比</label>
      <select class="form-control" ng-model="searchMap.pSizeRatioType" ng-options="m.value as m.text for m in dictMap['pSizeRatioTypeModel']" placeholder="大小配比"><option value="">--选择大小配比--</option></select>
    </div>
    <div class="form-group">
      <input type="date" class="form-control" placeholder="更新开始日期,如2015-01-01" ng-model="searchMap.updateDateStart" maxlength="10">
    </div> 

    <div class="form-group">
      <input type="date" class="form-control" placeholder="更新结束日期,如2015-01-01" ng-model="searchMap.updateDateEnd" maxlength="10">
    </div>
    <div class="form-group">
      <input type="number" class="form-control" placeholder="每页显示条数" ng-model="searchMap.pageSize" maxlength="7" max="100" min="1" style="width:180px" />
    </div>
    <button type="submit" class="btn btn-primary">查询</button>
    <button class="btn btn-primary" style="margin-left:10px;" ng-click="sendEmail();">发邮件</button>
  </form>
  <div>
    
  </div>
  <table class="table table-striped table-hover">
    <thead>
      <tr>
        <th><input type="checkbox" name="chkProjectAll" id="chkProjectAll" ng-click="chkProjectAll();" /></th>
        <th width="50" ng-click="orderby('id')" class="cur-p">ID<i class="orderby-icons" ng-class="{'orderby-asc':orderbyFreqMap['id'][orderbyPositionMap['id']] == 'asc','orderby-desc':orderbyFreqMap['id'][orderbyPositionMap['id']] == 'desc'}"></i></th>
        <th>产品名称</th>
        <th width="70">是否包销</th>
        <!--<th width="90">产品类型</th>
        <th width="80">期限</th>-->
        <th width="70">发布状态</th>
        <th width="70">审核状态</th>
        <th width="70">销售状态</th>
        <!--<th width="80">大小配比</th>-->

        <th width="70">产品负责人</th>
        <th width="70">产品对接人</th>
        <th width="70">对接人手机</th>
        <th width="70" hidden>承销人</th>
        <th width="70" hidden>承销人手机</th>

        <th width="80" class="text-center cur-p" ng-click="orderby('weight')">推荐状态<i class="orderby-icons-s" ng-class="{'orderby-asc':orderbyFreqMap['weight'][orderbyPositionMap['weight']] == 'asc','orderby-desc':orderbyFreqMap['weight'][orderbyPositionMap['weight']] == 'desc'}"></i></th>
        <th width="150" class="text-center cur-p" ng-click="orderby('updateDate')">最后更新时间<i class="orderby-icons" ng-class="{'orderby-asc':orderbyFreqMap['updateDate'][orderbyPositionMap['updateDate']] == 'asc','orderby-desc':orderbyFreqMap['updateDate'][orderbyPositionMap['updateDate']] == 'desc'}"></i></th>
        <th width="110px">操作</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="product in products">
        <td>
          <input type="checkbox" name="chkProject" accessId="{{product.pAccessId}}" value="{{product.id}}" />
        </td>
        <td>{{product.id}}</td>
        <td><a ng-click="toViewPage(product.id,'product/edit?')" href="javascript:">{{product.pName}}</a></td>
        <td>{{product.flagBaoxiao?"是":"否"}}</td>
        <!--<td>{{product.pType | productTypeRender}}</td>
        <td>{{product.pDueTime | dueTimeRender}}</td>-->
        <td class="product-public-status-{{product.pPublicStatus}}">{{product.pPublicStatus | productPublicStatusRender}}</td>
        <td class="product-status-{{product.status}}">{{product.status | productStatusRender}}</td>
        <td class="sale-status-{{product.pSaleStatus}}">{{product.pSaleStatus | productSaleStatusRender}}</td>
        <!--<td>{{product.pSizeRatioType | pSizeRatioTypeRender}}</td>-->

        <th width="80">{{product.createBy}}</th>
        <th width="80">{{product.pAccessName |hiddenFirst}}</th>
        <th width="80">{{product.pAccessMobile |hiddenMobile}}</th>
        <th width="80" hidden>{{product.uName}}</th>
        <th width="80" hidden>{{product.uMobile}}</th>

        <td class="text-center" ng-click="showChangeWeight(product.id)" class="cur-p">
          <span ng-show="!changeWeightMap[product.id]" title="点击修改">{{product.reCommendWeight}}</span>
          <select ng-show="changeWeightMap[product.id]" class="form-control" ng-init="productWeightMap[product.id]=product.reCommendWeight" ng-change="changeWeight(product.id)" ng-model="productWeightMap[product.id]" ng-options="m.value as m.text for m in dictMap['productCommendWeightModel']" placeholder="优化级" has-auth where="btn" who="PRODUCT_RECOMMEND"><option value="">优化级</option></select>
        </td>
        <td>{{product.updateDate | date:'yyyy-MM-dd HH:mm:ss' }}</td>
        <td class="optd">
          <a href="#/product/view?id={{product.id}}" has-auth where="btn" who="PRODUCT_QUERY" ng-if="false">详情</a>
          <!--<a href="#/product/edit?id={{product.id}}&t={{t}}" has-auth where="btn" who="PRODUCT_EDIT" owner="{{product.createBy}}">编辑</a>-->
          <a ng-click="toViewPage(product.id,'product/edit?')" href="javascript:" has-auth where="btn" who="PRODUCT_EDIT" owner="{{product.createBy}}">编辑</a>
          <a href="#/productOrderData/list?proId={{product.id}}&pType={{t}}" has-auth where="btn" who="PRODUCT_EDIT" owner="{{product.createBy}}">资料({{product.orderCount}})</a>
          <!--
          <a href="#/product/add?id={{product.id}}&t={{product.pType}}" has-auth where="btn" who="PRODUCT_EDIT" owner="{{product.createBy}}">复制</a>
          -->
          <a href="" ng-click="showCopyTypeLayer(product.id,product.pType)" has-auth where="btn" who="PRODUCT_EDIT" owner="{{product.createBy}}">复制</a>
          <a href="#/report/base?id={{product.id}}&t={{t}}" has-auth where="btn" who="PRODUCT_REPORT" ng-if="isAnalytics">解析报告</a>

           <a href="#/product/updateDate?pId={{product.id}}" has-auth where="btn" who="ORDER_UPDATE_ORDER_QUERY" >更新产品时间</a>

          <div class="dropdown pull-right" ng-if="false" has-auth where="btn" who="PRODUCT_UPDATE_SALEPROCESS,PRODUCT_PROFIT_LIST,PRODUCT_ATTACH_LIST,PRODUCT_DELETE,PRODUCT_VERIFY,PRODUCT_PUBLISH,PRODUCT_SET">
            <button class="btn btn-sm btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">更多操作<span class="caret"></span></button>
            <ul class="dropdown-menu dropdown-menu-right" role="menu" aria-labelledby="dropdownMenu1">
              <li role="presentation"><a role="menuitem" tabindex="-1" href="#/product/saleProcess?id={{product.id}}" has-auth where="btn" who="PRODUCT_UPDATE_SALEPROCESS">销售进度</a></li>
              <li role="presentation"><a role="menuitem" tabindex="-1" href="#/product/profit?id={{product.id}}" has-auth where="btn" who="PRODUCT_PROFIT_LIST">年化率及返佣</a></li>
              <li role="presentation"><a role="menuitem" tabindex="-1" href="#/product/attach?id={{product.id}}" has-auth where="btn" who="PRODUCT_ATTACH_LIST">附件管理</a></li>
              <li role="presentation" ng-click="deleteProduct(product.id)" ng-if="isDeleteable(product)" ng-confirm-click="请确认操作?" has-auth where="btn" who="PRODUCT_DELETE" owner="{{product.createBy}}"><a class="cur-p" role="menuitem" tabindex="-1">删除</a></li>
              <li role="presentation" ng-click="productPassVerify(product.id)" ng-if="isPassVerifyable(product)" ng-confirm-click="请确认操作?" has-auth where="btn" who="PRODUCT_VERIFY" owner="{{product.createBy}}"><a class="cur-p" role="menuitem" tabindex="-1">审核通过</a></li>
              <li role="presentation" ng-click="productPassPublish(product.id)" ng-if="isPassPublishable(product)" ng-confirm-click="请确认操作?" has-auth where="btn" who="PRODUCT_PUBLISH" owner="{{product.createBy}}"><a class="cur-p" role="menuitem" tabindex="-1">发布</a></li>
              <li role="presentation" ng-click="showProductEstablish(product.id)" ng-if="isPassEstablishable(product)" ng-confirm-click="请确认操作?" has-auth where="btn" who="PRODUCT_SET" owner="{{product.createBy}}"><a class="cur-p" role="menuitem" tabindex="-1">产品成立</a></li>
              <li role="presentation" ng-click="stopProduct(product.id,3)" ng-if="isStopable(product)" ng-confirm-click="请确认操作?" has-auth where="btn" who="PRODUCT_PUBLISH" owner="{{product.createBy}}"><a class="cur-p" role="menuitem" tabindex="-1">下架</a></li>
            </ul>
          </div>
        </td>
      </tr>
    </tbody>
  </table>

	<div class="pager-box" ng-include src="'tpl/public/pager.html'" ng-show="products.length > 0"></div>
  <button class="btn btn-primary" style="margin-left:10px;" ng-click="upDate();">批量更新募集进度修改时间</button>
</div>

<div class="layer-box" ng-show="isShowCopyTypeLayer">
  <div class="layer-bg"></div>
  <div class="layer-con " style="padding:10px 20px;">
    <span class="icons-close" title="关闭" ng-click="isShowCopyTypeLayer = false;">X</span>
    <div class="layer-title">
      请选择
    </div>
    <div class="con-wrap">
      <div class="form-group" >
        <a href="#/product/add?id={{copyId}}&t={{pt}}" class="btn btn-block btn-primary">仅复制产品</a>
        <a href="#/product/add?id={{copyId}}&t={{pt}}&ct=true" class="btn btn-block btn-primary">复制产品和解析报告</a>
        <a href="" class="btn btn-block btn-primary" ng-click="isShowCopyTypeLayer = false;">取消</a>
      </div>
    </div>
  </div>
</div> 

<div class="layer-box" ng-show="showEstablishaFormFlag">
  <div class="layer-bg"></div>
  <div class="layer-con " style="padding:10px 20px;">
    <span class="icons-close" title="关闭" ng-click="showEstablishaFormFlag = false;">X</span>
    <div class="layer-title">
      请填写成立时间
    </div>
    <div class="con-wrap">
      <form class="form-horizontal" role="form" name="estagForm" novalidate ng-submit="productEstablish()">
        <div class="form-group" ng-class="{'has-error':estagForm.pEstablishmentTimeStr.$invalid}"> 
          <input type="date" class="form-control" value="" ng-model="estabItem.pEstablishmentTimeStr" name="pEstablishmentTimeStr" required="required"/>
        </div> 
        <div class="form-group" >
          <input type="submit" class="btn btn-block btn-primary" value="保存" />
        </div>
      </form>
    </div>
  </div>
</div> 